﻿@using Microsoft.AspNet.Mvc.Description
@model ApiDescription

<div class="api-description">
    <h4>
        <span title="@Model.ActionDescriptor.DisplayName">
            @(Model.HttpMethod ?? "*") - @(Model.RelativePath ?? "Unknown Url")
        </span>
    </h4>
    <hr />

    <h5>Parameters:</h5>
    @if (Model.ParameterDescriptions.Count > 0)
    {
        <table>
            <thead>
                <tr>
                    <td>Name</td>
                    <td>Data Type</td>
                    <td>Source</td>
                </tr>
            </thead>
            <tbody>
                @foreach (var parameter in Model.ParameterDescriptions)
                {
                    <tr>
                        <td>@parameter.Name</td>
                        <td>@(parameter.Type?.FullName ?? "Unknown Type")</td>
                        <td>@parameter.Source.Id</td>
                    </tr>
                }
            </tbody>
        </table>
    }

    <h5>Response Formats</h5>
    @if (Model.SupportedResponseFormats.Count > 0)
    {
        <table>
            <thead>
                <tr>
                    <td>Data Type</td>
                    <td>Media Type</td>
                    <td>Formatter</td>
                </tr>
            </thead>
            <tbody>
                @foreach (var response in Model.SupportedResponseFormats)
                {
                    <tr>
                        <td>@Model.ResponseType.FullName</td>
                        <td>@response.MediaType.ToString()</td>
                        <td>@response.Formatter.GetType().Name</td>
                    </tr>
                }
            </tbody>
        </table>
    }
</div>